import React from 'react';
import { BetaSchemaForm } from "@ant-design/pro-components";
import type { ProFormColumnsType } from "@ant-design/pro-components";

/**
 * 搜索表单的属性类型
 * @template T - 表单数据类型
 */
export interface SearchFormProps<T> {
  /** 表单列配置 */
  columns: ProFormColumnsType<T>[];
  /** 表单提交回调 */
  onFinish: (values: T) => Promise<boolean>;
  /** 表单重置回调 */
  onReset?: () => void;
}

/**
 * 搜索表单组件
 * @template T - 表单数据类型
 */
const SearchForm = <T extends Record<string, any>>(props: SearchFormProps<T>) => {
  const { columns, onFinish, onReset } = props;

  return (
    <BetaSchemaForm<T>
      layoutType="QueryFilter"
      onFinish={onFinish}
      onReset={onReset}
      columns={columns}
    />
  );
};

export default SearchForm; 